<?php

namespace backend\controllers;


use Yii;
use yii\web\Controller;

/**
 * ImagesController implements the CRUD actions for Images model.
 */
class BaseController extends Controller
{
    public function beforeAction($action)
    {   //return true;
        if ($action->id == 'captcha')
            return true;
        else {

            $action = $action->id . $this->id;
//            echo $action;exit();

            if (\Yii::$app->user->can($action)) {
                return true;
            } else {
                throw new \yii\web\UnauthorizedHttpException('对不起，您现在还没获此操作的权限');
            }
         }
    }
}
